<%@page import="com.bstek.urule.accident.entity.Customer"%>
<%@page import="com.bstek.urule.law.entity.CaseInfo"%>
<%@page import="com.bstek.urule.runtime.KnowledgeSession"%>
<%@page import="com.bstek.urule.runtime.BatchSession"%>
<%@page import="com.bstek.urule.runtime.Business"%>
<%@page import="com.bstek.urule.runtime.KnowledgeSessionFactory"%>
<%@page import="com.bstek.urule.runtime.KnowledgePackage"%>
<%@page import="com.bstek.urule.runtime.service.KnowledgeService"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%
		ApplicationContext ac = WebApplicationContextUtils.getRequiredWebApplicationContext(application);
		KnowledgeService ks = (KnowledgeService) ac.getBean(KnowledgeService.BEAN_ID);
		KnowledgePackage kp = ks.getKnowledge("寿险意外险核保/totalResultTest");
		KnowledgeSession se = KnowledgeSessionFactory.newKnowledgeSession(kp);
		Customer cus = new Customer();
		cus.setId("C001");
		cus.setName("李四");
		cus.setAge(18);//年龄
		cus.setGender(true);//性别
		cus.setDiastolic(93.0);//舒张压
		cus.setSystolic(96.1);//收缩压
		cus.setCholesterol(3.0);//总胆固醇
		cus.setLowDensityLipoprotein(5.1);//低密度脂蛋白
		se.insert(cus);
		se.startProcess("totalResultFlow");
		out.print("总评点结果："+cus.getTotalResult());
		
		BatchSession bs = KnowledgeSessionFactory.newBatchSession(kp, 3, 10);
		for(int i=0; i<100; i++){
			bs.addBusiness(new Business(){
				
				public void execute(KnowledgeSession session){
					Customer cus = new Customer();
					cus.setId("C001");
					cus.setName("李四");
					cus.setAge(18);//年龄
					cus.setGender(true);//性别
					cus.setDiastolic(93.0);//舒张压
					cus.setSystolic(96.1);//收缩压
					cus.setCholesterol(3.0);//总胆固醇
					cus.setLowDensityLipoprotein(5.1);//低密度脂蛋白
					session.insert(cus);
					session.startProcess("totalResultFlow");
				}
			});
		}
		
		bs.waitForCompletion();
	%>
</body>
</html>